﻿using System.Windows.Controls;
using Caliburn.Actions;
using Caliburn.Castle;
using Caliburn.Commands;
using Caliburn.Core;
using Caliburn.RoutedUIMessaging;
using Castle.Windsor;

namespace AndyPike.Experiments.Caliburn
{
    public partial class App
    {
        public App()
        {
            var container = new WindsorContainer();
            var adapter = new WindsorAdapter(container);
            
            CaliburnApplication
                .ConfigureCore(adapter)
                .WithRoutedUIMessaging()
                .WithActions()
                .WithCommands()
                .StartApplication();

            var controller = container.Resolve<IRoutedMessageController>();

            controller.SetupDefaults(new GenericInteractionDefaults<Button>("MouseEnter", (b, v) => b.DataContext = v, b => b.DataContext));
        }
    }
}
